package flc.ast.adapter;


import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.stark.picselect.entity.SelectMediaEntity;

import flc.ast.R;
import flc.ast.bean.IconBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class IconAdapter extends StkProviderMultiAdapter<IconBean> {


    public IconAdapter() {
        addItemProvider(new StkSingleSpanProvider(126));
        addItemProvider(new IconProvider());
    }

    private class IconProvider extends BaseItemProvider<IconBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_icon;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, IconBean bean) {
            baseViewHolder.setImageResource(R.id.ivIconItemImg, bean.getImg());
            if (bean.isSelected()) {
                baseViewHolder.setBackgroundResource(R.id.rlIconItem, R.drawable.icon_sel);
            } else {
                baseViewHolder.setBackgroundResource(R.id.rlIconItem, 0);
            }
        }
    }

}
